﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using uk.org.aspellclark.todolistppc;

namespace SyncToolProgram
{
    public partial class Main : Form
    {
        List<SyncTask> tasks = new List<SyncTask>();
        string XMLFile = "";
        public Main()
        {
            InitializeComponent();
        }

        private void chkFile_CheckedChanged(object sender, EventArgs e)
        {
                openFileDialog1.ShowDialog();
                chkFile.Enabled = false;
            button1.Enabled = true;
        }
        private void DisableControls()
        {
            progressBar1.Visible = true;
            progressBar1.MarqueeAnimationSpeed = 30;
            progressBar1.Style = ProgressBarStyle.Marquee;
            chkFile.Enabled = false;
            chkGoogle.Enabled = false;
            chkTFS.Enabled = false;
        }
        private void EnableControls()
        {
            progressBar1.Visible = false;
            chkFile.Enabled = true;
            chkGoogle.Enabled = true;
            chkTFS.Enabled = true;

        }

        private void chkGoogle_CheckedChanged(object sender, EventArgs e)
        {
            chkGoogle.Enabled = false;
            button1.Enabled = true;
        }

        private void chkTFS_CheckedChanged(object sender, EventArgs e)
        {
            chkTFS.Enabled = false;
            button1.Enabled = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Reports reports = new Reports(tasks);
            reports.Show(this);
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            XMLFile = openFileDialog1.FileName;
            //label3.Text = openFileDialog1.FileName;
            Properties.Settings.Default.FilePath = openFileDialog1.FileName;
            Properties.Settings.Default.Save();
            Sync oSync = new Sync();
            tasks = oSync.GetTasksFromXml(XMLFile);
        }
    }
}
